"use strict";
function printName(name) {
    console.log(name.firstName + '-----' + name.secondName);
}
var obj = {
    age: 20,
    firstName: '张',
    secondName: '三'
};
printName(obj);
function ajax(config) {
    var xhr = new XMLHttpRequest;
    xhr.open('get', config.url, true);
    xhr.send(config.data);
    xhr.onreadystatechange = function () {
        if (xhr.readyState == 4 && xhr.status == 200) {
            console.log('成功');
            if (config.dataType == 'json') {
                console.log(JSON.parse(xhr.responseText));
            }
            else {
                console.log(xhr.responseText);
            }
        }
    };
}
ajax({
    type: 'get',
    data: 'name=zhangsan',
    url: 'http://a.itying.com/api/productlist',
    dataType: 'json'
});
